/*
 * Created by Jesse Phillips
 * Created on Feb 25, 2006
 */

/**
 * Stack implemented using a LinkedList.
 */
public class LinkedStack {
	private Node head = null;
	
	/**
	 * Add an item to the stack
	 * 
	 * @param item what is to be stored
	 */
	public void push(double item) {
		if(!isFull())
			head = new Node(item, head);
	}

	/**
	 * Return an item off the top of the stack.
	 * 
	 * @return the item in the stack
	 */
	public double pop() {
		if(!isEmpty()) {
			double value = head.getValue();
			head = head.next;
			return value;
		}
		return 0;
	}
	
	/**
	 * Checks to see if there is room in the stack
	 * stack can't be full
	 * 
	 * @return true if the stack is full
	 */
	public boolean isFull() {
		return false;
	}
	
	/**
	 * Checks the emptiness of the stack
	 * 
	 * @return true if the stack is empty
	 */
	public boolean isEmpty() {
		return head == null;
	}
	
}
